package com.adam.springmvc.generator.mapper;

import com.adam.springmvc.generator.model.Address;
import com.adam.springmvc.generator.model.AddressExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AddressMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    long countByExample(AddressExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int deleteByExample(AddressExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Delete({
        "delete from addresses",
        "where addr_id = #{addrId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer addrId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Insert({
        "insert into addresses (addr_id, street, ",
        "city, state, zip, ",
        "country)",
        "values (#{addrId,jdbcType=INTEGER}, #{street,jdbcType=VARCHAR}, ",
        "#{city,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, #{zip,jdbcType=VARCHAR}, ",
        "#{country,jdbcType=VARCHAR})"
    })
    int insert(Address row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int insertSelective(Address row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    List<Address> selectByExample(AddressExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Select({
        "select",
        "addr_id, street, city, state, zip, country",
        "from addresses",
        "where addr_id = #{addrId,jdbcType=INTEGER}"
    })
    @ResultMap("com.adam.springmvc.generator.mapper.AddressMapper.BaseResultMap")
    Address selectByPrimaryKey(Integer addrId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExampleSelective(@Param("row") Address row, @Param("example") AddressExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByExample(@Param("row") Address row, @Param("example") AddressExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    int updateByPrimaryKeySelective(Address row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table addresses
     *
     * @mbg.generated Wed Aug 21 21:00:08 CST 2024
     */
    @Update({
        "update addresses",
        "set street = #{street,jdbcType=VARCHAR},",
          "city = #{city,jdbcType=VARCHAR},",
          "state = #{state,jdbcType=VARCHAR},",
          "zip = #{zip,jdbcType=VARCHAR},",
          "country = #{country,jdbcType=VARCHAR}",
        "where addr_id = #{addrId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Address row);
}